#pragma once 
#include <stdint.h>
#include <time.h>
namespace TinyRPC{
/**
 * 时间戳类, 用来记录时间
 * 
 */
class TimeStamp{
public:
    uint64_t m_microSecSinceEpoch;
   
    static const uint64_t kMicroSecPerSecond = 1000*1000;
public:
    TimeStamp(): m_microSecSinceEpoch(0) {}
    TimeStamp(uint64_t microSecSinceEpoch)
    : m_microSecSinceEpoch(microSecSinceEpoch){}

    bool operator<(const TimeStamp& time) const{
        return m_microSecSinceEpoch < time.m_microSecSinceEpoch;
    }

    bool operator==(const TimeStamp& time)const{
        return m_microSecSinceEpoch == time.m_microSecSinceEpoch;
    }

    bool operator>(const TimeStamp& time) const{
        return m_microSecSinceEpoch > time.m_microSecSinceEpoch;
    }

    TimeStamp operator+(const TimeStamp& time){
        return TimeStamp(m_microSecSinceEpoch + time.m_microSecSinceEpoch);
    }

    TimeStamp operator-(const TimeStamp& time){
        return TimeStamp(m_microSecSinceEpoch - time.m_microSecSinceEpoch);
    }

    static TimeStamp Now();
};
}